package com.lyl.pipeline.autoconfigure;

import com.lyl.pipeline.annotation.PipeNodeHandler;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.context.annotation.ImportBeanDefinitionRegistrar;
import org.springframework.core.type.AnnotationMetadata;
import org.springframework.core.type.filter.AnnotationTypeFilter;

/**
 * @author Mr.Luo
 * @date 2022-07-27 21:04
 * @desc
 */
public class PipeNodeHandlerAutoConfigureRegistrar implements ImportBeanDefinitionRegistrar {
    @Override
    public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
        PipeNodeBeanDefinitionScanner scanner = new PipeNodeBeanDefinitionScanner(registry, false);
        scanner.registerFilters();
        scanner.addIncludeFilter(new AnnotationTypeFilter(PipeNodeHandler.class));
        scanner.doScan("com.lyl");
    }
}
